<template>
    <view class="container" style="padding-bottom: 240rpx">
        <view class="center-head"></view>
        <view style="position: absolute; top: 176rpx; left: 32rpx">
            <view class="head-top">
                <view class="head-top-fl" style="position: relative">
                    <image
                        @tap="__e"
                        class="headimg"
                        :data-event-opts="[['tap', [['toProfilePage', ['$event']]]]]"
                        hoverClass="hover"
                        :src="userInfo.headimg || 'https://cdn2.hquesoft.com/box/headimg/unlogin.png'"
                        style="position: absolute; top: 0; left: 0"
                        v-if="isLogin"
                    ></image>
                    <image
                        @tap="__e"
                        class="headimg"
                        :data-event-opts="[['tap', [['toLoginPage', ['$event']]]]]"
                        hoverClass="hover"
                        src="https://cdn2.hquesoft.com/box/headimg/unlogin.png"
                        style="position: absolute; top: 0; left: 0"
                        v-else
                    ></image>
                    <view
                        @tap="__e"
                        class="head-top-img"
                        :data-event-opts="[['tap', [['toProfilePage', ['$event']]]]]"
                        style="position: absolute; top: -30rpx; left: -30rpx; width: 160rpx; height: 160rpx"
                    >
                        <image :src="myInfo.thumb" style="width: 100%; height: 100%"></image>
                    </view>
                </view>
                <view class="head-top-fr">
                    <view class="head-top-title" v-if="isLogin">
                        <view class="head-top-name">{{ userInfo.name }}</view>
                    </view>
                    <view @tap="__e" :data-event-opts="[['tap', [['toLoginPage', ['$event']]]]]" v-else>点击登录</view>
                </view>
            </view>
            <block v-if="config.is_show_vip">
                <view @tap="__e" class="vip-c" :data-event-opts="[['tap', [['toBuyVip', ['$event']]]]]" v-if="userInfo.vip_status == 1">
                    <text class="new-iconfont icon-vip"></text>
                    <text>{{ $root.g0 + ' 到期' }}</text>
                </view>
                <view @tap="__e" class="vip-c disabled" :data-event-opts="[['tap', [['toBuyVip', ['$event']]]]]" v-else>
                    <text class="new-iconfont icon-vip"></text>
                    <text>开通VIP会员</text>
                </view>
            </block>
            <view class="jindutiao" style="position: relative">
                <view class="jindutiao-lv">{{ 'LV:' + myInfo.level + '' }}</view>
                <view class="jindutiao-num">
                    <view class="jindutiao-num-fl">{{ $root.f0 }}</view>
                    <view @tap="__e" class="jindutiao-num-fr" :data-event-opts="[['tap', [['memberDetail', ['$event']]]]]">查看我的权益 ></view>
                </view>
                <view class="pro">
                    <progress activeColor="#1884FE" backgroundColor="#101113" :percent="progress" strokeWidth="100" style="width: 100%; height: 8rpx"></progress>
                </view>
                <view style="color: #3c454e; margin-top: 12rpx; font-size: 18rpx">
                    <view class="propress-text" v-if="level_title">
                        <text style="color: #6c727a; font-size: 18rpx">{{ $root.f1 }}</text>
                        {{ '/' + next_score + ',距离下一级还需' }}
                        <text style="color: #6c727a; font-size: 18rpx">{{ need_level_score }}</text>
                    </view>
                    <view class="propress-text" style="color: #6c727a; font-size: 18rpx" v-else>{{ '' + myLevel.my_level_score + '/' + next_score + ',已满级' }}</view>
                </view>
            </view>
        </view>
        <view style="height: 140rpx"></view>
        <view class="status-bar">
            <view @tap="__e" class="item" :data-event-opts="[['tap', [['toDetail', ['/pages/myRedpack/index']]]]]">
                <view class="number">
                    {{ (userInfo.redpack || 0) / 100 }}
                    <text class="small-font">元</text>
                </view>
                <view class="text">我的余额:</view>
            </view>
            <view @tap="__e" class="item" :data-event-opts="[['tap', [['toDetail', ['/pages/myScore/index']]]]]">
                <view class="number">
                    {{ userInfo.score || 0 }}
                    <text class="small-font">枚</text>
                </view>
                <view class="text">{{ scoreAlias + ':' }}</view>
            </view>
        </view>
        <view class="order-c">
            <view class="order-c-top">
                <view class="title">我的订单</view>
            </view>
            <view class="body">
                <view @tap="__e" class="item" :data-event-opts="[['tap', [['toDetail', ['/pages/orderList/index?status=pay_pending']]]]]">
                    <view class="dot" v-if="orderStat.pay_pending">{{ '' + orderStat.pay_pending + '' }}</view>
                    <image mode="widthFix" src="/static/center/order-return-sale.png" style="width: 66rpx; height: 59rpx"></image>
                    <text>待付款</text>
                </view>
                <view @tap="__e" class="item" :data-event-opts="[['tap', [['toDetail', ['/pages/orderList/index?status=deliver_pending']]]]]">
                    <view class="dot" v-if="orderStat.deliver_pending">{{ '' + orderStat.deliver_pending + '' }}</view>
                    <image mode="widthFix" src="/static/center/order-deliver-pending.png" style="width: 66rpx; height: 59rpx"></image>
                    <text>待发货</text>
                </view>
                <view @tap="__e" class="item" :data-event-opts="[['tap', [['toDetail', ['/pages/orderList/index?status=delivered']]]]]">
                    <view class="dot" v-if="orderStat.delivered">{{ '' + orderStat.delivered + '' }}</view>
                    <image mode="widthFix" src="/static/center/order-delivered.png" style="width: 66rpx; height: 59rpx"></image>
                    <text>已发货</text>
                </view>
                <view @tap="__e" class="item" :data-event-opts="[['tap', [['toDetail', ['/pages/orderList/index?status=all']]]]]">
                    <view class="dot" v-if="orderStat.delivered">{{ '' + orderStat.delivered + '' }}</view>
                    <image mode="widthFix" src="/static/center/quanbudingdan.png" style="width: 66rpx; height: 59rpx"></image>
                    <text>全部订单</text>
                </view>
            </view>
        </view>
        <banner
            @__l="__l"
            class="center-banner"
            iStyle="height: 220rpx;"
            imageStyle="border-radius: 50rpx 50rpx 0rpx 0rpx; box-shadow: 10px 10rpx 10rpx 10rpx rgba(243, 238, 220, 0.4);"
            :list="config.banner"
            vueId="14680395-1"
            v-if="$root.g1"
        ></banner>
        <view class="order-c order-c2">
            <view class="body">
                <view @tap="__e" class="item" :data-event-opts="[['tap', [['toDetail', ['/pages/myCoupons/index']]]]]">
                    <view class="dot" v-if="userInfo.coupon_count">{{ '' + userInfo.coupon_count + '' }}</view>
                    <image mode="widthFix" src="/static/center/coupon.png" style="width: 66rpx; height: 59rpx"></image>
                    <text>优惠券</text>
                </view>
                <view @tap="__e" class="item" :data-event-opts="[['tap', [['toDetail', ['/pages/myCard/index']]]]]">
                    <view class="dot" v-if="userInfo.card_total">{{ '' + userInfo.card_total + '' }}</view>
                    <image mode="widthFix" src="/static/center/toushi.png" style="width: 66rpx; height: 59rpx"></image>
                    <text>道具卡</text>
                </view>
                <view @tap="__e" class="item" :data-event-opts="[['tap', [['toDetail', ['/pages/scoreRedPack/index']]]]]">
                    <view class="dot" v-if="count_score_redpack">{{ '' + count_score_redpack + '' }}</view>
                    <image mode="widthFix" src="/static/center/score.png" style="width: 66rpx; height: 59rpx"></image>
                    <text style="margin-right: 10rpx">赏包</text>
                </view>
                <view class="item" style="margin-bottom: 0rpx">
                    <button class="right" openType="contact" :plain="true" style="border: none; margin-bottom: 10rpx" v-if="isMiniappAndUseMiniappKf">
                        <image mode="widthFix" src="/static/center/kefu.png" style="width: 66rpx; height: 59rpx"></image>
                        <text style="margin-top: 0">客服中心</text>
                    </button>
                    <button @tap="__e" class="right" :data-event-opts="[['tap', [['openContact', ['$event']]]]]" :plain="true" style="border: none; margin-bottom: 15rpx" v-else>
                        <image mode="widthFix" src="/static/center/kefu.png" style="width: 66rpx; height: 59rpx"></image>
                        <text>客服中心</text>
                    </button>
                </view>
                <view
                    @tap="__e"
                    class="item"
                    :data-event-opts="[['tap', [['toLink', ['$0'], [[['items', '', index, 'link']]]]]]]"
                    hoverClass="hover"
                    v-for="(item, index) in items"
                    :key="index"
                >
                    <image :src="item.image" style="width: 66rpx; height: 59rpx"></image>

                    <text style="width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: center">{{ item.text }}</text>
                </view>
            </view>
        </view>
        <banner
            @__l="__l"
            class="center-banner"
            iStyle="height: 220rpx;"
            imageStyle="border-radius: 50rpx 50rpx 0rpx 0rpx; box-shadow: 10px 10rpx 10rpx 10rpx rgba(243, 238, 220, 0.4);"
            :list="config.banner"
            vueId="14680395-2"
            v-if="$root.g2"
        ></banner>
        <float-btn @__l="__l" :isAnimated="floatBtn.is_animate" :link="floatBtn.link" :src="floatBtn.image" vueId="14680395-3" v-if="floatBtn.is_show"></float-btn>
        <view class="version-c">{{ '版本: v' + version }}</view>
        <tab-bar @__l="__l" :isselected="3" vueId="14680395-4"></tab-bar>
    </view>
</template>

<script>
import banner from '@/components/Banner/Banner';
import floatBtn from '@/components/FloatBtn/FloatBtn';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/center/index'],
    {
        '16fd': function (e, t, n) {
            'use strict';

            n.r(t);
            var o = n('37bf');
            var i = n('82d5');
            for (var r in i) {
                if (['default'].indexOf(r) < 0) {
                    (function (e) {
                        n.d(t, e, function () {
                            return i[e];
                        });
                    })(r);
                }
            }
            n('89af');
            var a = n('f0c5');
            var s = Object(a.a)(i.default, o.b, o.c, false, null, null, null, false, o.a, void 0);
            t.default = s.exports;
        },
        3296: function (e, t, n) {},
        '37bf': function (e, t, n) {
            'use strict';

            n.d(t, 'b', function () {
                return i;
            });
            n.d(t, 'c', function () {
                return r;
            });
            n.d(t, 'a', function () {
                return o;
            });
            var o = {
                Banner: function () {
                    return n.e('components/Banner/Banner').then(n.bind(null, '8003'));
                },
                FloatBtn: function () {
                    return n.e('components/FloatBtn/FloatBtn').then(n.bind(null, 'e690'));
                }
            };
            var i = function () {
                var that = this;
                var t =
                    (that.$createElement,
                    that._self._c,
                    that.config.is_show_vip && 1 == that.userInfo.vip_status ? that.$tool.formatDate(that.userInfo.vip_end_at, 'yyyy-MM-dd') : null);
                var n = that._f('0')(that.myLevel.my_level_score);
                if (that.level_title) {
                    var o = that._f('0')(that.myLevel.my_level_score);
                } else {
                    var o = null;
                }
                var i = that.config.banner && that.config.banner.length;
                var r = that.config.banner && that.config.banner.length;
                that.$mp.data = Object.assign(
                    {},
                    {
                        $root: {
                            g0: t,
                            f0: n,
                            f1: o,
                            g1: i,
                            g2: r
                        }
                    }
                );
            };
            var r = [];
        },
        '82d5': function (e, t, n) {
            'use strict';

            n.r(t);
            var o = n('d32b');
            var i = n.n(o);
            for (var r in o) {
                if (['default'].indexOf(r) < 0) {
                    (function (e) {
                        n.d(t, e, function () {
                            return o[e];
                        });
                    })(r);
                }
            }
            t.default = i.a;
        },
        '89af': function (e, t, n) {
            'use strict';

            var o = n('3296');
            n.n(o).a;
        },
        '9afa': function (e, t, n) {
            'use strict';

            (function (e, t) {
                var o = n('4ea4');
                n('18ba');
                o(n('66fd'));
                var i = o(n('16fd'));
                e.__webpack_require_UNI_MP_PLUGIN__ = n;
                t(i.default);
            }.call(this, n('bc2e').default, n('543d').createPage));
        },
        d32b: function (e, t, n) {
            'use strict';

            (function (e) {
                var o = n('4ea4');
                Object.defineProperty(t, '__esModule', {
                    value: true
                });
                t.default = void 0;
                var i = o(n('9523'));
                function r(e, t) {
                    var n = Object.keys(e);
                    if (Object.getOwnPropertySymbols) {
                        var o = Object.getOwnPropertySymbols(e);
                        if (t) {
                            o = o.filter(function (t) {
                                return Object.getOwnPropertyDescriptor(e, t).enumerable;
                            });
                        }
                        n.push.apply(n, o);
                    }
                    return n;
                }
                function a(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        if (null != arguments[t]) {
                            var n = arguments[t];
                        } else {
                            var n = {};
                        }
                        t % 2
                            ? r(Object(n), true).forEach(function (t) {
                                  (0, i.default)(e, t, n[t]);
                              })
                            : Object.getOwnPropertyDescriptors
                            ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n))
                            : r(Object(n)).forEach(function (t) {
                                  Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
                              });
                    }
                    return e;
                }
                var s = {
                    name: 'center',
                    components: {},
                    data: function () {
                        return {
                            level_title: true,
                            need_level_score: 0,
                            next_score: 0,
                            heightEle1: 0,
                            heightEle2: 0,
                            heightEle3: 0,
                            progress: 0,
                            myLevel: {},
                            version: '1.0.7',
                            init: false,
                            orderStat: {},
                            count_score_redpack: 0,
                            myInfo: {},
                            vipShow: false
                        };
                    },
                    computed: a(
                        a({}, (0, n('26cb').mapGetters)(['deviceInfo', 'userInfo', 'token', 'personalSettings'])),
                        {},
                        {
                            isLogin: function () {
                                return !!this.token;
                            },
                            isscoreRedpack: function () {
                                return this.token && this.scoreRedpack ? (this.count_score_redpack = this.scoreRedpack[0]) : (this.count_score_redpack = 0);
                            },
                            userName: function () {
                                return this.token ? this.userInfo.name : '点击登录';
                            },
                            avatar: function () {
                                return this.token ? this.userInfo.headimg : '/static/toux.png';
                            },
                            config: function () {
                                return this.$store.getters.setting.user_center;
                            },
                            items: function () {
                                return (this.config && this.config.items) || [];
                            },
                            isAnimated: function () {
                                return true;
                            },
                            floatBtn: function () {
                                return {
                                    is_show: this.config.is_show_float_btn,
                                    link: this.config.float_btn_link,
                                    image: this.config.float_btn_image,
                                    is_animate: this.config.float_btn_is_animate
                                };
                            }
                        }
                    ),
                    onLoad: function () {
                        this.$visitor.record('center');
                    },
                    onShow: function () {
                        var that = this;
                        this.getMyInfo();
                        this.getLevelList();
                        if (this.isLogin) {
                            this.$store.dispatch('getUserInfo').then(function (n) {
                                that.$http('/order-stat').then(function (e) {
                                    that.orderStat = e.data.info;
                                });
                                if (that.userInfo && '微信用户' == that.userInfo.name) {
                                    e.showModal({
                                        title: '检测到您使用的是微信默认昵称!请先修改',
                                        confirmText: '去修改',
                                        showCancel: false,
                                        success: function (e) {
                                            if (e.confirm) {
                                                that.toProfilePage();
                                            }
                                            console.log('用户点击确定');
                                        }
                                    });
                                }
                            });
                            this.$store.dispatch('getCountScoreRedpack').then(function (e) {
                                that.count_score_redpack = e.data.info[0];
                            });
                        }
                    },
                    methods: {
                        getLevelList: function () {
                            var that = this;
                            this.$http('/task/level_list').then(function (t) {
                                that.myLevel = t.data;
                                that.need_level_score = t.data.next_task_level_info.need_level_score - t.data.my_level_score;
                                that.progress = (t.data.my_level_score / t.data.next_task_level_info.need_level_score) * 100;
                                that.next_score = t.data.next_task_level_info.need_level_score;
                                if (50 == t.data.my_task_level && 0 == t.data.next_task_level_info.length) {
                                    that.next_score = t.data.my_level_score;
                                    that.progress = 100;
                                    that.level_title = false;
                                }
                            });
                        },
                        getMyInfo: function () {
                            var that = this;
                            this.$http('/task/level_list?no_list=1')
                                .then(function (t) {
                                    that.myInfo = t.data.my_task_level_info;
                                    that.vipShow = true;
                                })
                                .catch(function (e) {
                                    console.log(e);
                                });
                        },
                        toProfilePage: function () {
                            e.navigateTo({
                                url: '/pages/myProfile/index'
                            });
                        },
                        toDetail: function (t) {
                            e.navigateTo({
                                url: t
                            });
                        },
                        toDayTask: function () {
                            this.isAnimated = false;
                            e.navigateTo({
                                url: '/pages/dayTask/index'
                            });
                        },
                        toBuyVip: function () {
                            e.navigateTo({
                                url: '/pages/buyVip/index'
                            });
                        },
                        memberDetail: function () {
                            e.navigateTo({
                                url: '/member/pages/memberGrade/memberGrade'
                            });
                        }
                    }
                };
                t.default = s;
            }.call(this, n('543d').default));
        }
    },
    [['9afa', 'common/runtime', 'common/vendor']]
]);
</script>
<style>
@import './index.css';
</style>
